package com.chinatsp.onlineapp.ui.weather;

import com.chinatsp.onlineapp.R;

import android.annotation.SuppressLint;
import android.app.DialogFragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

@SuppressLint("NewApi")
public class CitySelectFragment extends DialogFragment {

	private Button btn_sure;
	private Button btn_cancle;
	private CheckBox cb1;
	private CheckBox cb2;
	private TextView tv2;
	private TextView tv1;
	private RelativeLayout rl1;
	private RelativeLayout rl2;
	private ImageView iv1;
	private ImageView iv2;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View root = inflater.inflate(R.layout.dialog_select_city, null);

		rl1 = (RelativeLayout) root.findViewById(R.id.rl1);
		rl2 = (RelativeLayout) root.findViewById(R.id.rl2);
		tv1 = (TextView) root.findViewById(R.id.tv1);
		tv2 = (TextView) root.findViewById(R.id.tv2);
		iv1 = (ImageView) root.findViewById(R.id.iv1);
		iv2 = (ImageView) root.findViewById(R.id.iv2);
		btn_sure = (Button) root.findViewById(R.id.btn1);
		btn_cancle = (Button) root.findViewById(R.id.btn2);

		iv1.setSelected(true);

		rl1.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				if (iv1.isSelected()) {
					return;
				} else {
					iv1.setSelected(true);
					iv2.setSelected(false);
				}
			}
		});
		rl2.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				if (iv2.isSelected()) {
					return;
				} else {
					iv2.setSelected(true);
					iv1.setSelected(false);
				}
			}
		});

		btn_sure.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {

			}
		});
		btn_cancle.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {

			}
		});

		return root;
	}
}
